package com.weilive.api;

import org.springframework.context.ApplicationContext;

/**
 * 服务器常量配置
 * 
 * @author houzhiwei
 * 
 */
public final class ServerContext {
	// spring容器管理
	private static ApplicationContext context = null;

	private ServerContext() {
	}

	public static Object getBean(String beanName) {
		return (Object) context.getBean(beanName);
	}

	public static Object getBean(Class<?> claze) {
		String className = claze.getSimpleName();
		className = className.substring(0, 1).toLowerCase() + className.substring(1);

		return getBean(className);
	}

	public static void setContext(ApplicationContext context) {
		ServerContext.context = context;
	}

}
